<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateCouponsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('coupons', function (Blueprint $table) {
            $table->id();
            $table->bigInteger('member_id')->unsigned()->comment('会员id');
            $table->string('name','30')->comment('卡券名字');
            $table->string('address', 255)->comment('卡券核销地址');
            $table->integer('cover')->unsigned()->comment('卡券封面,用户素材库id');
            $table->char('type',2)->comment('卡券类型');
            $table->string('type_value', 255)->comment('卡券面值{face:100,value:10}');
            $table->tinyInteger('time_type')->unsigned()->comment('卡券时间限制类型(1=永久有效，2=过期时间，3=领券后几天后过期)');
            $table->integer('time')->unsigned()->comment('时间，过期时间或者有效天数');
            $table->text('detail')->comment('卡券核销规则说明');
            $table->tinyInteger('status')->unsigned()->comment('卡券状态（1=正常，2=审核，3=审核未通过，9=删除）');
            $table->softDeletes();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('coupons');
    }
}
